//   Copyright [2012] [Brian P. Clark]
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.

package com.kungkhies.common.services.kungkhie.validate.knodes;

import com.kungkhies.xml.schema.kungkhie.KungkhieType;
import java.util.Map;

/**
 * An interface defining the methods used to validate the node structure of a
 * kungkhie.
 * 
 * The @code{KungkhieTyoe} object is created by XMLBeans operating on the
 * main kungkhie schema and is present in the dependency 
 * @code{KungkhieImplSXml-0.9.jar}
 * 
 * @author clayton
 */
public interface KnodesValidatorService
{
    /**
     * 
     * @param kungkhieType
     * @return
     * @throws KnodeValidateException 
     */
    public Map createNodeIdentifierMap(KungkhieType kungkhieType) throws KnodeValidateException;
    
    
    
    /**
     * 
     * @param kungkhieType
     * @return
     * @throws KnodeValidateException 
     */
    public int findStartNode(KungkhieType kungkhieType) throws StartKnodeException;
    
    /**
     * 
     * @param kungkhieType
     * @return
     * @throws KnodeValidateException 
     */
    
    /**
     * 
     * @param kungkhieType
     * @return
     * @throws KnodeValidateException 
     */
    public int findFinishNode(KungkhieType kungkhieType) throws FinishKnodeException;
    
    /**
     * 
     * @return
     * @throws KnodeValidateException 
     */
    public int[][] createAdjacencyMatrix() throws KnodeValidateException;
    
    /**
     * 
     * @param adjacencyMatrix
     * @return 
     */
    public boolean validateAdjacencyMatrix(int[][] adjacencyMatrix);
    
    /**
     * 
     * @param kungkhieType
     * @return
     * @throws KnodeValidateException 
     */
    public Map createLevelMap(KungkhieType kungkhieType) throws KnodeValidateException;
    
    /**
     * 
     * @param connectionMatrix
     * @throws KnodeValidateException 
     */
    public void validateNodeType(int[][] connectionMatrix) throws KnodeValidateException;
    
    /**
     * 
     * @param kungkhieType
     * @return
     * @throws KnodeValidateException 
     */
    public int[][] createIncidenceMatrix(KungkhieType kungkhieType) throws KnodeValidateException;
    
    /**
     * 
     * @param incidenceMatrix
     * @return 
     */
    public boolean validateIncidenceMatrix(int[][] incidenceMatrix);
    
    /**
     * 
     * @param kungkhieType
     * @return
     * @throws KnodeValidateException 
     */
    public Map createNodeTypeMap(KungkhieType kungkhieType) throws KnodeValidateException;
}
